package unclassified.medium;

import java.util.concurrent.locks.ReentrantLock;

public class MaximumProductOfWordLengths_318 {

    public int maxProduct(String[] words) {
        int[] arr = new int[words.length];
        for (int i = 0; i < words.length; i++) {
            for (int j = 0; j < words[i].length(); j++) {
                int c = words[i].charAt(j) - 'a';
                arr[i] |= 1 << c;
            }
        }
        int res = 0;
        for (int i = 0; i < words.length; i++) {
            for (int j = i + 1; j < words.length; j++) {
                if ((arr[i] & arr[j]) == 0) {
                    res = Math.max(res, words[i].length() * words[j].length());
                }
            }
        }
        return res;
    }

    public static void main(String[] args) {
        ReentrantLock rn = new ReentrantLock();
    }
}
